<?php
$params = array_merge(
    require __DIR__ . '/../../common/config/params.php',
    require __DIR__ . '/params.php'
);

$config=  [
    'id' => 'app-backend',
    'basePath' => dirname(__DIR__),
    'name'                => 'ICEKE',
    'controllerNamespace' => 'backend\controllers',
    'defaultRoute'        => 'site/index',
    'bootstrap' => ['log'],
    'modules' => [
        'user' => [
            'class' => 'backend\modules\user\UserModule',
        ],
    ],
    'components' => [
        'request' => [
            'csrfParam' => '_csrf-backend',
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => 'LwEFJHVf1rL8WLJ00Q9x_q5dbwJjM_ry',
        ],
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
        ],
        'session' => [
            // this is the name of the session cookie used for login on the backend
            'name' => 'advanced-backend',
        ],
        'assetManager' => [
            'basePath'        => '@webroot/statics/assets',
            'baseUrl'         => '@web/statics/assets',
            'linkAssets'      => false, // 软链接方式发布
            'appendTimestamp' => true, // 发布资源的时候带时间戳
            'bundles'         => [
                'yii\web\JqueryAsset' => [
                    //'jsOptions' => ['position' => \yii\web\View::POS_END],
                    //'sourcePath' => null,   // do not publish the bundle
                    'js' => [
                        YII_DEBUG ? 'jquery.js' : 'jquery.min.js'
                        //'//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js',
                    ],
                ],
            ],
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,  //true：美化的url，可以去掉?r=
            'showScriptName' => true, //隐藏index.php
            'suffix' => '', //后缀，如果设置了此项.html，那么浏览器地址栏就必须带上.html后缀（加载控制器方法的后面），否则会报404错误
            'rules' => [
            ],
        ],

    ],
    'params' => $params,
];

if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
    ];

    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
        'allowedIPs'    => ['*'],
    ];
}

return $config;

